﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;

namespace ClipboardCapture
{
    public partial class frmFileName : Form
    {
        
        public frmFileName(Settings settings)
        {
            InitializeComponent();        
            cbFormat.SelectedIndex = settings.Format;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            Error("", false);
            if (!string.IsNullOrEmpty(txbxFilename.Text))
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                Error("No filename has been typed.", true);
                return;
            }
        }

        private void Error(string p, bool p_2)
        {
            lblError.Text = p;
            lblError.Visible = p_2;
        }

        public string FileName
        {
            get { return txbxFilename.Text; }
        }

        public ImageFormat FileFormat
        {
            get
            {
                int i = cbFormat.SelectedIndex;
                if (i == 0)
                    return ImageFormat.Png;
                else if (i == 1)
                    return ImageFormat.Jpeg;
                else
                    return ImageFormat.Png;
            }
        }
    }
}
